# Maintainer: Filipe Laíns (FFY00) <lains@archlinux.org>

_pkgname=easy-pdk-programmer-software
pkgname=easy-pdk
pkgver=1.3
pkgrel=3
pkgdesc='Easy PDK programmer for PADAUK microcontroller'
arch=('loong64' 'x86_64')
url='https://github.com/free-pdk/easy-pdk-programmer-software'
license=('GPL')
depends=('glibc')
makedepends=('arm-none-eabi-gcc' 'arm-none-eabi-newlib' 'dfu-util')
optdepends=('dfu-util: flash the programmer')
source=("$pkgname-$pkgver.tar.gz::$url/archive/$pkgver.tar.gz")
sha512sums=('d9c21ddc258018a45da2864b03b8f507a71b4086251867cad1cf157fa651ae211dded6717ee4920d8d417712c72e5dc47445271c4000e43f2dfcffa2e93fc1ab')

build() {
  make -C $_pkgname-$pkgver
  make -C $_pkgname-$pkgver/Firmware/source
}

package() {
  cd $_pkgname-$pkgver

  install -Dm 755 easypdkprog -t "$pkgdir"/usr/bin/
  install -Dm 644 Linux_udevrules/70-stm32vcp.rules -t "$pkgdir"/usr/lib/udev/rules.d/
  install -Dm 644 Firmware/source/build/EASYPDKPROG.{bin,dfu} -t "$pkgdir"/usr/share/$pkgname/
}

